<template>
  <div class="public_main">
    <div class="crumbs">
      <el-breadcrumb separator="/">
        <el-breadcrumb-item>{{$t('sidebar.dataReport')}}</el-breadcrumb-item>
        <el-breadcrumb-item>{{$t('newcrumbs.crumbsFiv')}}</el-breadcrumb-item>
        <el-breadcrumb-item>{{$t('add.no17')}}</el-breadcrumb-item>
      </el-breadcrumb>
    </div>
    
    <!-- -------------搜索查询栏------------------------ -->
      <search 
			:searchData="searchData" 
			@search="search" 
			@putExcel="putExcel" 
			:searchRight="true"
			:outputRight="$store.state.common.permiss.artificialdata.includes('export')"
    ></search>
    
    <!-- -------------表单显示栏------------------------ -->
    <div class="table">
       <el-table size="small" :data="tableData" :summary-method="getSummaries"
          show-summary>
          <el-table-column align="center" prop="approveTime" :label="$t('add.no43')" width="140">
            <template slot-scope="scope">
              <span v-if="scope.row.approveTime!=''">{{(scope.row.approveTime).slice(0,10)}}</span>
              <span v-else>{{$store.state.common.nullData}}</span>
            </template>
          </el-table-column>
          <el-table-column align="center" prop="adminName" :label="$t('public.no32')">
          </el-table-column>
          <el-table-column align="center" prop="newCustomerOrders" :label="$t('add.no19')">
          </el-table-column>
          <el-table-column align="center" prop="newCustomerPassOrders" :label="$t('add.no20')">
          </el-table-column>
          <el-table-column align="center"  prop="newCustomerPassRate" :label="$t('add.no21')">
            <template slot-scope="scope">
              <span class="red">{{$store.getters.twoPoint(scope.row.newCustomerPassRate)}}</span>
            </template>
          </el-table-column>
          <el-table-column align="center"  prop="newCustomerOverRate" :label="$t('add.no22')">
            <template slot-scope="scope">
              <span class="red">{{$store.getters.twoPoint(scope.row.newCustomerOverRate)}}</span>
            </template>
          </el-table-column>
          <el-table-column align="center" prop="oldCustomerOrders" :label="$t('add.no23')">
          </el-table-column>
          <el-table-column align="center" prop="oldCustomerPassOrders" :label="$t('add.no24')">
          </el-table-column>
          <el-table-column align="center"  prop="oldCustomerPassRate" :label="$t('add.no25')">
            <template slot-scope="scope">
              <span class="red">{{$store.getters.twoPoint(scope.row.oldCustomerPassRate)}}</span>
            </template>
          </el-table-column>
          <el-table-column align="center"  prop="oldCustomerOverRate" :label="$t('add.no26')">
            <template slot-scope="scope">
              <span class="red">{{$store.getters.twoPoint(scope.row.oldCustomerOverRate)}}</span>
            </template>
          </el-table-column>
          <el-table-column align="center"   prop="customerPassRate" :label="$t('add.no27')">
            <template slot-scope="scope">
              <span class="green">{{$store.getters.twoPoint(scope.row.customerPassRate)}}</span>
            </template>
          </el-table-column>
          <el-table-column align="center"   prop="customerOverRate" :label="$t('add.no28')">
            <template slot-scope="scope">
              <span class="green">{{$store.getters.twoPoint(scope.row.customerOverRate)}}</span>
            </template>
          </el-table-column>
        </el-table>
    </div>

    <!-- ------------  分页显示栏  ------------------------ -->
    <el-row type="flex" justify="end">
      <div class="pages" >
        <el-pagination
          @current-change="handleCurrentChange"
          :current-page="pagination.current"
          layout="sizes, prev, pager, next, total,->"
          :page-sizes="pagination.pageSizeOptions"
          :page-size="pagination.pageSize"
          @size-change="handleSizeChange"
          :total="pagination.total">
        </el-pagination>
      </div>
    </el-row>
    <div class="foot"></div>

  </div>
</template>
<script>
import putExcel from 'src/mixins/putExcel.js';//导出excel
export default {
  name: 'peopleFirstAuditTotal',
  mixins:[putExcel],
  data () {
    const searchData=[
      {
        type: 'rangePicker',
        label: 'riskManage.approveTime',
        attr: 'searchTime',
        value: [],
      }
    ]
    return {
      pagination: {
        pageSize: global.config.pageSize,
        pageSizeOptions: global.config.pageSizeOptions,
        current: 1,
        total: 0,
      },
      searchData:searchData,
      flag: true,
      formInline: {// 用户查询信息数据对应字段
        approveTimeBegin: "",
        approveTimeEnd: ""
      },
      tableData: [],// 列表数据模拟
      tableData1: [],// 列表数据模拟
      putExcelUrl:this.$action.risk_approveManExport
    }
  },
  methods: {
    handleSizeChange (val) {// 每页条数变化时操作
      this.pagination.pageSize = val;
      this.getTableData();
    },
    handleCurrentChange (val) { // 分页按钮点击操作
      this.pagination.current = val;
      this.getTableData();
    },
    search(search) { // 搜索
        this.formInline=search;
        this.formInline.approveTimeBegin=search.searchTime?search.searchTime[0]:'';
        this.formInline.approveTimeEnd=search.searchTime?search.searchTime[1]:'';
        if (this.flag) {
          this.flag = false;
          this.pagination.current = 1;
          this.getTableData();
        }
    },
    getTableData () { // 获取人工审核统计列表
      let option = {
        pageNum:this.pagination.current,
        pageSize:this.pagination.pageSize,
        param: {
          ...this.formInline
        }       
      }
      this.$axios.post(this.$action.risk_approveManList, option).then(res => {
        this.flag = true;
        if (res.code == 200) {
          this.tableData = res.data.pageDTO.list;
          this.tableData1 = res.data.orderReviewReportDO;
          this.pagination.total = res.data.pageDTO.total;
        }
      })
    },
    getSummaries() {// 总和
      const sums=[];
      if(this.tableData1){
        const sums = [
          this.$t('public.addTotal'),
          '-',
          this.tableData1.newCustomerPassOrders,
          this.tableData1.newCustomerPassOrders,
          this.$store.getters.twoPoint(this.tableData1.newCustomerPassRate),
          this.$store.getters.twoPoint(this.tableData1.newCustomerOverRate),
          this.tableData1.oldCustomerOrders,
          this.tableData1.oldCustomerPassOrderS,
          this.$store.getters.twoPoint(this.tableData1.oldCustomerPassRate),
          this.$store.getters.twoPoint(this.tableData1.oldCustomerOverRate),
          this.$store.getters.twoPoint(this.tableData1.customerPassRate),
          this.$store.getters.twoPoint(this.tableData1.customerOverRate)
          // this.$store.getters.twoPoint(this.tableData1.reviewSuccessRateCounts)+'%',
        ];
      }
        return sums;
    }
  },
  mounted () {
    this.getTableData();// 获取人工审核统计列表
  }
}
</script>
<style scoped lang="scss">

</style>
